package com.example.controller;

import com.example.domain.Holder;
import com.example.domain.R;
import com.example.service.HolderService;
import com.example.domain.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;

@RestController
@RequestMapping("/holder")
public class HolderController {
    @Autowired
    private HolderService holderService;

    @PostMapping("/getData")
    public R getData(@RequestBody HashMap<String,Object> reqMap){
        User user = holderService.getData(
                reqMap.get("pageNum"),
                reqMap.get("pageSize"),
                reqMap.get("pram1"),
                reqMap.get("pram2")
        );
        return R.success(user);
    }

    @PostMapping
    public R saveHolder(@RequestBody Holder holder){
        holderService.saveHolder(holder);
        return R.success("插入成功");
    }

    @GetMapping("/selectById")
    public R selectById(String holderId){
        Holder holder = holderService.selectById(holderId);
        return R.success(holder);
    }





}
